<template>
  <div>
    <a-row v-for="fk in fkList" :key="'' + Math.random()">
      <a-col :span="24">
        <a-tree-select
          style="width:120px;"
          v-model="fk.from"
          :treeData="colTree[subTable]"
          :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
          treeDefaultExpandAll
          :disabled="true"
        >
        </a-tree-select>
        &nbsp;
        <span v-if="fk.type=='parentField'">
          子表外键 对应 主表字段
        </span>
        <span v-else-if="fk.type=='childField'">
          子表字段 对应 主表外键
        </span>
        <span v-else-if="fk.type=='fixedValue'">
          {{fk.value}}
        </span>
        <a-tree-select
          v-else
          style="width:120px;"
          v-model="fk.value"
          :treeData="colTree[mainTable]"
          :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
          treeDefaultExpandAll
          :disabled="true"
        >
        </a-tree-select>
        &nbsp;
      </a-col>
    </a-row>
  </div>
</template>

<script>

  export default {
    name: "FkEdit",
    props: {
      fkList: {
        type: Array,
        default: () => []
      },
      colTree: {
        type: Object,
        default: () => {
        }
      },
      mainTable: {
        type: String,
        default: ''
      },
      subTable: {
        type: String,
        default: ''
      }
    },
    data() {
      return {}
    },
    methods: {
      handleChange() {
        this.$emit("change");
      },

    },
    created() {

    }
  }
</script>
